package com.aisb.login;

import com.aisb.core.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Map;

/**
 * @Description：
 * @Author wucm
 * @Date 2017/12/28
 */
@Service
public class LoginService {

    @Autowired
    LoginDao loginDao;

    public Result login(Map param){
        String userId = (String) param.get("userId");
        String userPwd = (String) param.get("userPwd");

        if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(userPwd)){
            return new Result(false, "请输入用户名和密码");
        }

       Object u = loginDao.queryOne(param);
        if(null == u){
            return new Result(false, "用户或密码错误，请重新输入");
        }

        return new Result(true, "");
    }
}
